package demo1;

import static java.lang.Thread.sleep;

class MyThread extends Thread{
    @Override
    public void run() {
        while (true) {
            System.out.println("hello thread");
            /*try {
                sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }*/
        }
    }
}

public class Test {
    public static void main(String[] args) {
        Thread it=new MyThread();
        it.start();
        while (true) {
            System.out.println("hello main");
            try {
                sleep(1000);
            }catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }


}
